package com.kuangstudy.collection.set;

import java.util.HashSet;

/**
 * ClassName: Application
 * date: 2021/07/12 20:16:32
 *hashset对象判断是否同一个需要重写hashcode和equals方法
 * @author zlk
 */
public class Application {
    public static void main(String[] args) {
        Student s1 = new Student("kk1", 10);
        Student s2 = new Student("kk2", 11);
        Student s3 = new Student("kk2", 11);
        Student s4 = new Student("kk3", 13);
        HashSet<Student> students = new HashSet<>();
        students.add(s1);
        students.add(s2);
        students.add(s3);
        students.add(s4);
        System.out.println(students);
        students.remove(s2);
        System.out.println(students);
    }
}
